import { showToast } from "utils/index";
const behav = require("../behavior");
Component({
  behaviors: [behav],
  externalClasses: ["song-item-one"],
  options: {
    styleIsolation: "apply-shared",
  },
  properties: {
    list: {
      type: Array,
      value() {
        return [];
      },
    },
  },

  data: {
    newList: [],
  },
  observers: {
    list(newVal = []) {
      newVal = newVal.map((item) => {
        item.singers = item.song.artists.map((it) => it.name).join(" - ");
        return item;
      });
      this.setData({
        newList: newVal,
      });
    },
  },
  methods: {
    //切换喜欢状态（是否喜欢）
    // toggleLove(e) {
    //   const { ind } = e.currentTarget.dataset;
    //   const { isLove } = this.data.newList[ind];
    //   showToast(isLove ? "已从喜欢列表移除" : "已添加进喜欢列表");
    //   this.setData({
    //     [`newList[${ind}].isLove`]: !isLove,
    //   });
    // },
  },
});
